package dxc01;

import java.util.concurrent.Callable;

/* 1.定义一个类MyCallable实现Callable接口
 2.在MyCallable类中重写call()方法*/
public class MyCallable implements Callable<Integer> {
    @Override
    public Integer call() throws Exception {
        int sum = 0;
        for (int i = 1; i <= 100; i++) {
            sum += i;
        }
        //返回值就表示线程运行完毕之后的结果
        return sum;
    }
}
